const ACCESS_TOKEN = 'access_token'
const REFRESH_TOKEN = 'refresh_token'

class Token {
  // TODO 暂时没有双令牌机制 先设为内部方法不对外暴露
   saveTokens (accessToken, refreshToken) {
    localStorage.setItem(ACCESS_TOKEN, `Bearer ${accessToken}`)
    localStorage.setItem(REFRESH_TOKEN, `Bearer ${refreshToken}`)
  }

  static saveAccessToken (accessToken) {
    localStorage.setItem(ACCESS_TOKEN, `${accessToken}`)
  }

  static getToken (tokenKey) {
    return localStorage.getItem(tokenKey)
  }

  static removeToken () {
    localStorage.removeItem(ACCESS_TOKEN)
    localStorage.removeItem(REFRESH_TOKEN)
  }
}

export default Token
